
#include <Nb30.h>
typedef struct _ASTAT_
{
	ADAPTER_STATUS   adapt;
	NAME_BUFFER   NameBuff   [30];
}ASTAT,   *   PASTAT;



string CNetManager::MakeLocalMac()
{
	vector<string> vMac;
	NCB ncb;
	LANA_ENUM lana_enum;
	UCHAR uRetCode;

	memset(&ncb, 0, sizeof(ncb));
	memset(&lana_enum, 0, sizeof(lana_enum));
	ncb.ncb_command = NCBENUM;
	ncb.ncb_buffer = (unsigned char *)&lana_enum;
	ncb.ncb_length = sizeof(LANA_ENUM);
	uRetCode = Netbios(&ncb);
	if(uRetCode != NRC_GOODRET)
		return "";

	for(int lana=0; lana<lana_enum.length; lana++)
	{
		ASTAT Adapter;
		memset(&ncb,0,sizeof(ncb));    
		ncb.ncb_command=NCBRESET;      
		ncb.ncb_lana_num=lana_enum.lana[lana];
		uRetCode=Netbios(&ncb);

		memset(&ncb, 0, sizeof(ncb));
		ncb.ncb_command = NCBASTAT;
		ncb.ncb_lana_num = lana_enum.lana[lana];
		strcpy((char*)ncb.ncb_callname, "*");
		ncb.ncb_buffer = (unsigned char *)&Adapter;
		ncb.ncb_length = sizeof(Adapter);
		uRetCode = Netbios(&ncb);
		if(uRetCode != NRC_GOODRET)
			continue;

		UCHAR * uMAC = Adapter.adapt.adapter_address;
		char Mac[18]={0};
		sprintf(Mac,"%02X-%02X-%02X-%02X-%02X-%02X",uMAC[0],uMAC[1],uMAC[2],uMAC[3],uMAC[4],uMAC[5]);

		vMac.push_back(Mac);
	}

	

	return vMac.at(0);
}